package com.example.imtoken.modules.main.wallet.details

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.imtoken.modules.main.wallet.details.trade.record.TransactionRecordFragment

class WalletDetailsAdapter(
    private val coin: String?,
    fragmentManager: FragmentManager,
    lifecycle: Lifecycle
) :
    FragmentStateAdapter(fragmentManager, lifecycle) {
    override fun getItemCount(): Int {
        return 4
    }

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> TransactionRecordFragment().setType(0).setCoin(coin)
            1 -> TransactionRecordFragment().setType(1).setCoin(coin)
            2 -> TransactionRecordFragment().setType(2).setCoin(coin)
            3 -> TransactionRecordFragment().setType(3).setCoin(coin)
            else -> throw Exception("没有更多的Fragment")
        }
    }
}